import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AbilityAssessmentVO, AbilityAssessmentForm, AbilityAssessmentQuery } from '@/api/nursing/abilityAssessment/types';

/**
 * 查询老年人能力评估列表
 * @param query
 * @returns {*}
 */

export const listAbilityAssessment = (query?: AbilityAssessmentQuery): AxiosPromise<AbilityAssessmentVO[]> => {
  return request({
    url: '/nursing/abilityAssessment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询老年人能力评估详细
 * @param id
 */
export const getAbilityAssessment = (id: string | number): AxiosPromise<AbilityAssessmentVO> => {
  return request({
    url: '/nursing/abilityAssessment/' + id,
    method: 'get'
  });
};

/**
 * 新增老年人能力评估
 * @param data
 */
export const addAbilityAssessment = (data: AbilityAssessmentForm) => {
  return request({
    url: '/nursing/abilityAssessment',
    method: 'post',
    data: data
  });
};

/**
 * 修改老年人能力评估
 * @param data
 */
export const updateAbilityAssessment = (data: AbilityAssessmentForm) => {
  return request({
    url: '/nursing/abilityAssessment',
    method: 'put',
    data: data
  });
};

/**
 * 删除老年人能力评估
 * @param id
 */
export const delAbilityAssessment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/abilityAssessment/' + id,
    method: 'delete'
  });
};
